var jxkhdfxjField = WfForm.convertFieldNameToId("jxkhdfxj"); //绩效考核等分小计fieldid
var zwkhdfxjField = WfForm.convertFieldNameToId("zwkhdfxj"); //职务考核等分小计fieldid
var zxkhdfxjField = WfForm.convertFieldNameToId("zxkhdfxj"); //专项考核等分小计fieldid
var gjkzkhxjField = WfForm.convertFieldNameToId("gjkzkhxj"); //关键控制等分小计fieldid

var dt1xmlbField = WfForm.convertFieldNameToId("xmlb","detail_1"); //明细1fieldid
var dt1dfField = WfForm.convertFieldNameToId("df","detail_1"); //等分1fieldid

var dt2xmlbField = WfForm.convertFieldNameToId("xmlb","detail_2"); //明细1fieldid
var dt2dfField = WfForm.convertFieldNameToId("df","detail_2"); //等分1fieldid

var dt3xmlbField = WfForm.convertFieldNameToId("xmlb","detail_3"); //明细1fieldid
var dt3dfField = WfForm.convertFieldNameToId("df","detail_3"); //等分1fieldid

var dt4xmlbField = WfForm.convertFieldNameToId("xmlb","detail_4"); //明细1fieldid
var dt4dfField = WfForm.convertFieldNameToId("df","detail_4"); //等分1fieldid

var dt5xmlbField = WfForm.convertFieldNameToId("xmlb","detail_5"); //明细1fieldid
var dt5dfField = WfForm.convertFieldNameToId("df","detail_5"); //等分1fieldid

var dt6xmlbField = WfForm.convertFieldNameToId("xmlb","detail_6"); //明细1fieldid
var dt6dfField = WfForm.convertFieldNameToId("df","detail_6"); //等分1fieldid

var dt7xmlbField = WfForm.convertFieldNameToId("xmlb","detail_7"); //明细1fieldid
var dt7dfField = WfForm.convertFieldNameToId("df","detail_7"); //等分1fieldid
jQuery().ready(function(){
	sumhj();
	WfForm.bindDetailFieldChangeEvent(dt1xmlbField + "," + dt1dfField + ","
	+ dt2xmlbField + "," + dt2dfField  + "," + dt3xmlbField + "," + dt3dfField
	+ "," + dt4xmlbField + "," + dt4dfField  + "," + dt5xmlbField + "," + dt5dfField
	+ "," + dt6xmlbField + "," + dt6dfField  + "," + dt7xmlbField + "," + dt7dfField,function(id,rowIndex,value) {
		sumhj();
	});


});
function sumhj() {
	var dfdata = {1:0,2:0,3:0,4:0};	//	等分数据    专项考核 4   关键控制考核 3 绩效考核 2  职务考核 1
	var mxbs1 = WfForm.getDetailAllRowIndexStr("detail_1");
	mxbs1.split(",").forEach(function(index) {
		var xmlb = WfForm.getFieldValue(dt1xmlbField+"_"+index);
		var df = WfForm.getFieldValue(dt1dfField+"_"+index);
		if (xmlb && xmlb != "" && df && df != "") {
			var ndf = parseFloat(df) + parseFloat(dfdata[xmlb]);
			dfdata[xmlb] = ndf.toFixed(2);
		}
	})
	var mxbs2 = WfForm.getDetailAllRowIndexStr("detail_2");
	mxbs2.split(",").forEach(function(index) {
		var xmlb = WfForm.getFieldValue(dt2xmlbField+"_"+index);
		var df = WfForm.getFieldValue(dt2dfField+"_"+index);
		if (xmlb && xmlb != "" && df && df != "") {
			var ndf = parseFloat(df) + parseFloat(dfdata[xmlb]);
			dfdata[xmlb] = ndf.toFixed(2);
		}
	})
	var mxbs3 = WfForm.getDetailAllRowIndexStr("detail_3");
	mxbs3.split(",").forEach(function(index) {
		var xmlb = WfForm.getFieldValue(dt3xmlbField+"_"+index);
		var df = WfForm.getFieldValue(dt3dfField+"_"+index);
		if (xmlb && xmlb != "" && df && df != "") {
			var ndf = parseFloat(df) + parseFloat(dfdata[xmlb]);
			dfdata[xmlb] = ndf.toFixed(2);
		}
	})
	var mxbs4 = WfForm.getDetailAllRowIndexStr("detail_4");
	mxbs4.split(",").forEach(function(index) {
		var xmlb = WfForm.getFieldValue(dt4xmlbField+"_"+index);
		var df = WfForm.getFieldValue(dt4dfField+"_"+index);
		if (xmlb && xmlb != "" && df && df != "") {
			var ndf = parseFloat(df) + parseFloat(dfdata[xmlb]);
			dfdata[xmlb] = ndf.toFixed(2);
		}
	})
	var mxbs5 = WfForm.getDetailAllRowIndexStr("detail_5");
	mxbs5.split(",").forEach(function(index) {
		var xmlb = WfForm.getFieldValue(dt5xmlbField+"_"+index);
		var df = WfForm.getFieldValue(dt5dfField+"_"+index);
		if (xmlb && xmlb != "" && df && df != "") {
			var ndf = parseFloat(df) + parseFloat(dfdata[xmlb]);
			dfdata[xmlb] = ndf.toFixed(2);
		}
	})
	var mxbs6 = WfForm.getDetailAllRowIndexStr("detail_1");
	mxbs6.split(",").forEach(function(index) {
		var xmlb = WfForm.getFieldValue(dt6xmlbField+"_"+index);
		var df = WfForm.getFieldValue(dt6dfField+"_"+index);
		if (xmlb && xmlb != "" && df && df != "") {
			var ndf = parseFloat(df) + parseFloat(dfdata[xmlb]);
			dfdata[xmlb] = ndf.toFixed(2);
		}
	})
	var mxbs7 = WfForm.getDetailAllRowIndexStr("detail_1");
	mxbs7.split(",").forEach(function(index) {
		var xmlb = WfForm.getFieldValue(dt7xmlbField+"_"+index);
		var df = WfForm.getFieldValue(dt7dfField+"_"+index);
		if (xmlb && xmlb != "" && df && df != "") {
			var ndf = parseFloat(df) + parseFloat(dfdata[xmlb]);
			dfdata[xmlb] = ndf.toFixed(2);
		}
	})
	//	等分数据    专项考核 4   关键控制考核 3 绩效考核 2  职务考核 1
	WfForm.changeFieldValue(jxkhdfxjField, {value:dfdata[2]});
	WfForm.changeFieldValue(zwkhdfxjField, {value:dfdata[1]});
	WfForm.changeFieldValue(zxkhdfxjField, {value:dfdata[4]});
	WfForm.changeFieldValue(gjkzkhxjField, {value:dfdata[3]});
	console.log("dfdata:",dfdata);
}
